package com.dailyblue.java.project.smbms.provider.controller;

import com.dailyblue.java.commons.util.JsonResult;
import com.dailyblue.java.commons.util.ResultTool;
import com.dailyblue.java.project.smbms.provider.service.ProviderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/provider")
@Slf4j
public class ProviderController {
    @Resource
    private ProviderService providerService;

    @GetMapping("/{id}")
    public JsonResult find(@PathVariable("id") int id) {
        log.info("准备查询{}的供应商信息", id);
        return ResultTool.success(providerService.getById(id));
    }
    @GetMapping
    @CrossOrigin
    public JsonResult find(){
        return ResultTool.success(providerService.findBySelect());
    }
}
